<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>第99步</title>
  </head>
  <body style="font-size: 50px">
    模拟一个扩展情况, 有若干个停车场, 找到一个空位最少的停
    <br /><br /><br />
    打开控制台并 刷新 查看停车效果
  </body>
  <script src="../js/parkingLot.js"></script>
  <script src="../js/parkingAttendant.js"></script>
  <script>
    const num = 100;
    const parkingLotList = [];
    const parkingLotCountList = [];
    for (let i = 0; i < num; i++) {
      const item = new parkingLot({
        isFull: false,
        total: 10,
      });
      parkingLotList.push(item);
      parkingLotCountList.push(item.getCarList());
    }

    const res = parkingAttendant('lessSpaceFree', parkingLotCountList);
    console.log(`第${res}个停车场车位最少`);
    res !== -1 && parkingLotList[res].parking("我");
    console.table(parkingLotCountList);
  </script>
</html>
